#include <iostream>
using namespace std;

class Student
{
public:
    Student(int score) : m_score(score){}//初始化列表
public:
    virtual void study()
    {

        cout<<"Student::study()"<<endl;
    }
    int getScore()
    {
        return m_score;
    }

private:
    int m_score;
    int m_age = 10;

};

class Worker
{
public:
    Worker(int salary) : m_salary(salary){}//初始化列表
public:
    virtual void work()
    {

        cout<<"Worker::work()"<<endl;
    }

    int getSalary()
    {
        return m_salary;
    }

private:
    int m_salary;
    int m_age = 20;
};

/* 多继承 */
class underGrad : public Student, public Worker
{
public:
//构造函数的互相调用要写在初始化列表
    underGrad(int score,int salary,int grade) : Student(score),Worker(salary),m_grade(grade){}
    int getGrate()
    {
        return m_grade;
    }
    void show()
    {
        // cout<<"score: "<<getScore()<<endl;
        // cout<<"salary: "<<getSalary()<<endl;
        // cout<<"grade: "<<m_grade<<endl;          
        cout<<Student::m_age<<endl;
        cout<<Worker::m_age<<endl;
        cout<<m_age<<endl; 
    }
public:
    void play()
    {
        cout<<"underGrad::play()"<<endl;
    }
    
private:
    int m_grade;
    int m_age = 30;
};

int main()
{
    underGrad ug(80,10000,2);
    ug.show();

    // cout<<"sizeof(ug):"<<sizeof(ug)<<endl;
    // cout<<"hello world"<<endl;

    return 0;
}